<?php include './application/views/common/zhs_header.php';?>
<?php include './application/views/common/zhs_usercenter_acnt.php';?>
<div class="inv_box w">
<?php include './application/views/common/zhs_usercenter_left.php';?>
  <div class="membd_right">
     <h3 class="membdrg_tit">登录密码</h3>
    <div class="mem_perbox">
    <form id="pwd_form">
<input type="hidden" name="act" value="submit">
   <ul class="perboxul">
   	<li><span>原始密码：</span><p><input type="password" value="" maxlength="20" name="oldpwd"></p></li>
   	<li><span>新密码：</span><p>	<input type="password" value="" maxlength="20" name="newpwd" id="newpwd"></p></li>
   	<li><span>确认密码：</span><p><input type="password" value="" maxlength="20" name="newpwd2" id="newpwd2"></p></li>
   	<li><input style="margin-left:124px; margin-top:0;" type="button"  class="little_button"  size="30" value="确认修改" onclick="pwdSubmit();">	</li>
   	
   </ul>
   </form>
    </div>
     <script>
function pwdSubmit(){
	var options = {
		url : GetUrlRelativePath(),
		clearForm :true,
		resetForm :true,
		beforeSubmit:  checkForm,
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg==''){
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}},
					close: function() {
						if(ret.url==''){
							window.location.reload();
						}else{
							window.location=ret.url;
						}
					}
				}); 
				$("#msg").html("操作成功");
			}else{
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}}
				}); 
				$("#msg").html(ret.msg);
			}
		}
	};
	$("#pwd_form").ajaxSubmit(options);
	return false;
}

function checkForm(){
	var pregName = /(?!^(\d+|[a-zA-Z]+|[~!#$^&?_]+)$)^[\w~!#$\^&?_]+$/;
	var err = '';
	if($('#oldpwd').val()==''){
		err = '请输入旧密码';
	}else if(!pregName.test($('#newpwd').val()) || $('#newpwd').val().length <=5){
		err = '无效新密码，必须含有数字+字母，其中只允许~!#$^&?_字符';
	}else if($('#newpwd2').val()==''){
		err = '请重复新密码';
	}else if($('#newpwd').val()!=$('#newpwd2').val()){
		err = '两次密码输入不一致';
	}
	if(err==''){
		return true;
	}else{
		$('#dialog').dialog({
			modal:true, //蒙层（弹出会影响页面大小）
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}}
		}); 
		$("#msg").html(err);
		return false;
	}
}
</script>
  </div>
</div> 

<?php include './application/views/common/zhs_footer.php';?>
<?php include './application/views/common/zhs_right.php';?>

